<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="/static/images/order/timg.jpg">
    <link rel="icon" href="/static/images/order/timg.jpg">
    <title>{$title}</title>
    {css href="/static/layout/css/style.css" }
    {css href="/static/layout/css/style-responsive.css" }
    {css href="/static/css/toastr.min.css"}

    {css href="/static/index/css/index.css"}
    {css href="/static/css/details.css"}
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="js/html5shiv.js"></script>
    <script src="js/respond.min.js"></script>
    <![endif]-->

    {css href="/static/index/css/detail.css"}
    <style>
      .denglu:hover{cursor:pointer;}
      .mgr20{margin-right: 20px}
      .delBtn{margin-left:10px;}
       .mod{width:120px;height:40px;background-color:#eeeeee;line-height:18px;text-align:center;font-size:1em;border:none;color:#65CEA7;float:right;margin-right:133px;margin-top:16px;display:block;border-radius:5px;outline:none;}
    </style>
</head>
<body class="horizontal-menu-page" style="background: #fffffa;">
	<nav class="navbar navbar-default" role="navigation">
	    <div class="container-fluid">
	        <!-- Brand and toggle get grouped for better mobile display -->
	        <div class="navbar-header">
	            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
	                <span class="sr-only">Toggle navigation</span>
	                <span class="icon-bar"></span>
	                <span class="icon-bar"></span>
	                <span class="icon-bar"></span>
	            </button>
	            <a class="navbar-brand" href="{:url('index/Index/index')}">
	                <img src="/static/index/images/logo.png" height="42px">
	            </a>
	        </div>


	        <!-- Collect the nav links, forms, and other content for toggling -->
	        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
	            <ul class="nav navbar-nav">
                    <li><a href="{:url('index/Index/index')}">首页</a></li>
                    <li><a href="{:url('index/Category/index')}?where=0">分类 </a></li>
                    <li><a href="{:url('index/Category/rank',['id'=>0])}">榜单 </a></li>
                    <li><a href="{:url('index/Register/registerauthor')}">成为作者</a></li>
                    <li><a href="{:url('index/Author/index')}">作者专区</a></li>
                </ul>

	            <ul class="nav navbar-nav navbar-right" style="margin-right:100px;">
	                <li>
	                    <form class="navbar-form navbar-left" role="search" action="{:url('index/Index/find')}" method="post">
	                        <div class="form-group">
	                            <input type="text" class="form-control" placeholder="Search" name="search">&nbsp;
	                            <button class="btn btn-info ">搜索</button>
	                             <!-- <input type="submit" value="搜索" class="form-control"> -->
	                        </div>
	                    </form>
	                </li>
                    {if ( empty($Think.session.user) && empty($Think.cookie.loginid) )}
                    <li class="dropdown">
                        <a href="{:url('index/Register/index')}">注册</a> <b lass="caret"></b>
                    </li>
                    <li class="denglu"><a type="button" data-toggle="modal" data-target=".bs-example-modal-sm">登陆</a>

                        <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog"
                             aria-labelledby="mySmallModalLabel">
                            <div class="modal-dialog modal-sm" role="document">
                                <div class="modal-content" style="margin-top: 250px;">
                                    <form action="{:url('index/Login/login')}" method="post">
                                        <!-- <img src="" alt=""> -->
                                        <input type="text" class="form-control" name="tel" autocomplete="off" maxlength="11" placeholder="账号">
                                        <input type="password" class="form-control" name="pass" autocomplete="off" placeholder="密码">
                                        <div class="form-group">
                                            <div class="col-sm-10">
                                                <div class="checkbox">
                                                    <label>
                                                        <input type="checkbox" name="checkbox">记住密码
                                                    </label>
                                                </div>
                                            </div>
                                        </div>
                                        <button type="submit" class="btn btn-default btn-lg btn-block">登陆</button>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </li>
                    <li class="denglu"><a type="button" data-toggle="modal" data-target=".bs-example-modal-sm">购物车</a></li>
                    {else/}
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                         {if empty($Think.session.user.icon) && empty($Think.cookie.loginicon)}
                             <img src="/static/images/details/10.jpg">
                        {else/} 
                          <img src="{$Think.session.user? $Think.session.user.icon : $Think.cookie.loginicon}">
                          {/if}
                            {$Think.session.user? $Think.session.user.name : $Think.cookie.loginname} 
                            <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            <li><a href="{:url('index/BookShelf/index')}">我的书架
                            <li><a href="{:url('index/Personal/index',['id'=>$Request.session.user.id])}">我的账号</a></li>
                            <li><a href="{:url('index/Login/logout')}">注销</a></li>
                        </ul>
                    </li>
                    <li class="denglu"><a href="{:url('index/BuyCar/read',['id'=>$Request.session.user.id])}">购物车 ({$Think.cookie.count})</a></li>
                    {/if}
                </ul>
            </div><!-- /.navbar-collapse -->
        </div><!-- /.container-fluid -->
	</nav>


	<div class="detailbox">
        <div class="leftSide">
            <div class="bookdetail">
                <a href=""><img src="{$data.face}"></a>
                <h3>{$data.name}</h3>
                <span>电子书</span>
                <ul>
                    <li>{$data.hot}人在读</li>
                    <li>作者：<span>{$data.author}</span></li>
                    <li>版权方：<span>{$data.copyright}</span></li>
                    <li>标签：<span>{$data.tag}</span></li>
                </ul>
                <div class="bookprice">
                    <span>价格：</span>
                    <span>&yen;{$data.price}</span>
                    <button id="collect" data-id="{$data.id}">收藏</button>
                </div>
                <div class="detailbtn">
                    {if ( empty($Think.session.user) && empty($Think.cookie.loginid) )}                 
                     <button type="button" class="btn btn-primary btn-lg detaildesc1" data-target="#myModal">购买全本</button>
                    {else/}
                    <button type="button" class="btn btn-primary btn-lg detaildesc" data-toggle="modal" data-target="#myModal">{$info.dee}</button>
                    {/if}
                    <a href="{:url('index/Details/readbook',['id'=>$data['id']])}">开始阅读</a>
                </div>
                <button class="mod" id="buycar" data-id="{$data.id}">加入购物车</button> 
            </div>
        <!-- Button trigger modal -->

            <div class="bookinfo">
                <div class="booklink">
                    <a class="link-item default" href="#introduct">简介</a> <a class="link-item" href="#dir">目录</a> 
                    <a class="link-item" href="#reply">评论 {$count_cmt==0? '': '('.$count_cmt.')'}</a>
                </div>
                <div class="about">
                    <!-- 简介锚点 -->         
                    <a href="" name="introduct"></a>
                    <div class="info main">
                        <span class="title-icon"></span>
                        <span class="title-txt">图书简介</span>
                        <p>如果你是高考生，不知怎么报志愿，那么你需要这本书，让你轻松入门，制订目标。如果你是学生家长，不知如何让孩子自主学习、帮孩子选择一个好未来，那么你需要这本书，听张雪峰老师聊心态、谈理想、讲方法。本书可以解决以下问题：高中时代应当怎样度过？报志愿时，选学校，还是选专业？不浪费一分的志愿，就好志愿吗？该不该服从调剂？哪些专业是未来前景最好的？</p>
                    </div>
                    <div class="info main">
                        <span class="title-icon"></span>
                        <span class="title-txt">作者简介</span>
                        <p>张雪峰，教育界资深名嘴。中国第一批研究高等院校及专业选择的领军人物，从业十余年，专业精深，影响广泛。全国各大高校累计讲座1000余场，听众累计上千万人。2016年因专业、幽默的讲座视频爆红网络，视频总点击过亿次，超千万转发分享，激情风趣的授课风格深受学生追捧，被亲切称为“神嘴”，成为各大媒体争相追逐的焦点。</p>
                    </div>

                    <div class="info main">
                        <span class="title-icon"></span>
                        <span class="title-txt">基本信息</span>
                        <div class="bd">
                            <ul style="height: 85px;">
                                <li><span class="book-tip">作<span class="ml28">者：</span></span>
                                    <a href="" class="">{$data.author}</a> </li>
                                <li><span class="book-tip">出版时间：</span>{$data.ctime}</li>
                                <li><span class="book-tip">版<span class="ml7">权</span><span class="ml7">方：
                                    </span></span><a href="">{$data.copyright}</a>
                                </li>
                                <li><span class="book-tip">分<span class="ml28">类：</span></span>
                                    <a href="{:url('index/Category/showSon',['pid'=>$one.id])}/?where=0">{$one.name}</a>&nbsp;＞
                                    <a href="{:url('index/Category/showSon',['id'=>$two.id])}/?where=0">{$two.name}</a>
                                </li>

                            </ul> 
                        </div>
                    </div>
                    
                    <!-- 目录锚点 -->
                    <a href="" name="dir"></a>
                    <div class="dir " style="clear: both;margin-bottom: 30px">
                        {if (empty($dir) )}
                        <div class="dir-tit">目录（共4章）</div>
                        <ul class="info">
                            <li class="dir-name level">
                                <span class="title-icon" style="top: 10px;"></span>
                               <span class="title-txt"> <a href="{:url('index/Details/readbook',['id'=>$data['id']])}">第一章 如何度过你的高中生活</a></span>
                            </li>
                             <li class="dir-name level">
                                <span class="title-icon" style="top: 10px;"></span>
                                <span class="title-txt"><a href="{:url('index/Details/readbook',['id'=>$data['id']])}">第二章 怎样了解一个大学</a></span>
                            </li>
                            <li class="dir-name level">
                            <span class="title-icon" style="top: 10px;"></span>
                            <span class="title-txt"><a href="{:url('index/Details/readbook',['id'=>$data['id']])}">第三章 报志愿的时候应该优先选择学校，还是优先选..</a></span>
                            </li>
                            <div class="hidden-box">
                                <li class="dir-name level">
                                <span class="title-icon" style="top: 10px;"></span>
                                <span class="title-txt"><a href="{:url('index/Details/readbook',['id'=>$data['id']])}">第四章 不浪费一分的志愿就是好志愿吗</a></span>
                                </li>
                            </div>
                            <li class="dir-name level">
                                <a href="javascript:;" class="showbtn">
                                    <span class="showAll">查看全部</span>
                                    <span class="ic flr"></span>
                                </a>
                            </li>
                        </ul>
                    
                    {else/}
                     <div class="dir-tit">目录（共{$count_dir}章）</div>
                        <ul class="info">
                          {if empty($status)}
                                {volist name="dir" id="v" key="k" offset="0" length="3"}
                                <li class="dir-name level">
                                   <span class="title-icon" style="top: 10px;"></span>
                                   <span class="title-txt"> 
                                    <a href="{:url('index/Details/readbook',['id'=>$data['id']])}/?page={$k}">
                                       {$v['name']}</a></span>
                                </li>
                                {/volist}
                                {volist name="dir" id="v" offset="3"}
                                <li class="dir-name level">
                                    <span class="title-icon" style="top: 10px;"></span>
                                   <span class="title-txt" style="color:#999">{$v['name']}</span>
                                </li>
                                {/volist}
                          {else/}
                                {volist name="dir" id="v" key="k"}
                                <li class="dir-name level">
                                   <span class="title-icon" style="top: 10px;"></span>
                                   <span class="title-txt"> 
                                   <a href="{:url('index/Details/readbook',['id'=>$data['id']])}/?page={$k}">
                                       {$v['name']}</a></span>
                                </li>
                                {/volist}
                          {/if}
                        </ul>
                    {/if}
                </div>

                    <!-- 回复锚点 -->
                    <a href="" name="reply"></a>
                    <div class="comment">
                        <div class="dir-tit" name="md">图书评论</div>
                        <div class="score">
                            <div class="over-score">
                                <div class="in-over">
                                    <span class="in-tit">综合评分</span>  
                                    <span class="stars">    
                                        <b class="ic star-on"></b>
                                        <b class="ic star-on"></b>
                                        <b class="ic star-on"></b>
                                        <b class="ic star-on"></b>
                                        <b class="ic star-half"></b>
                                    </span>
                                    <span class="in-score">{$score}</span>
                                </div>
                            </div>
                            <div class="site-score">
                                <div class="site-wp">
                                    <div class="item-star">
                                        <span class="score-tit">5星</span>
                                        <span class="scont">
                                            <b class="ic star-on-s"></b>
                                            <b class="ic star-on-s"></b>
                                            <b class="ic star-on-s"></b>
                                            <b class="ic star-on-s"></b>
                                            <b class="ic star-on-s"></b>
                                        </span>
                                        <span class="score-num">267人</span>
                                    </div>
                                    <div class="item-star">
                                        <span class="score-tit">4星</span>
                                        <span class="scont">
                                            <b class="ic star-on-s"></b>
                                            <b class="ic star-on-s"></b>
                                            <b class="ic star-on-s"></b>
                                            <b class="ic star-on-s"></b>
                                            <b class="ic star-off-s"></b>
                                        </span>
                                        <span class="score-num">4人</span>
                                    </div>
                                    <div class="item-star">
                                        <span class="score-tit">3星</span>
                                        <span class="scont">
                                            <b class="ic star-on-s"></b>
                                            <b class="ic star-on-s"></b>
                                            <b class="ic star-on-s"></b>
                                            <b class="ic star-off-s"></b>
                                            <b class="ic star-off-s"></b>
                                        </span>
                                        <span class="score-num">2人</span>
                                    </div>
                                    <div class="item-star">
                                        <span class="score-tit">2星</span>
                                        <span class="scont">
                                            <b class="ic star-on-s"></b>
                                            <b class="ic star-on-s"></b>
                                            <b class="ic star-off-s"></b>
                                            <b class="ic star-off-s"></b>
                                            <b class="ic star-off-s"></b>
                                        </span>
                                        <span class="score-num">9人</span>
                                    </div>
                                    <div class="item-star">
                                        <span class="score-tit">1星</span>
                                        <span class="scont">
                                            <b class="ic star-on-s"></b>
                                            <b class="ic star-off-s"></b>
                                            <b class="ic star-off-s"></b>
                                            <b class="ic star-off-s"></b>
                                            <b class="ic star-off-s"></b>
                                        </span>
                                        <span class="score-num">3人</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="comment-box" style="width: 760px; margin-top: 20px">
                    {if (empty($count_cmt))}<p class="no-text">暂无评论</p>
                    {else /}
                    <span class="com-count">共有{$count_cmt}条评论</span><span class="switch"></span>
                    <ul class="comt-list" style="padding-top: 5px;">
                       
                       {volist name="comment" id="v"}
                        <li class="comt-item">
                            <div class="comt-icon"><img src="{$v.icon}"></div>
                             <div class="comt-info">{$v.name}&nbsp;&nbsp;【购买用户】
                                <span class="stars">    
                                        <b class="ic star-on"></b>
                                        <b class="ic star-on"></b>
                                        <b class="ic star-on"></b>
                                        <b class="ic star-on"></b>
                                        <b class="ic star-on"></b>
                                </span>
                             {$v.cmt}&nbsp; {$v.ctime} &nbsp;&nbsp;来自百度阅读</div>
                            <div class="comt-cont">{$v.content}</div>
                            <div class="comt-comt">
                                <a href="javascript:;" class="repBtn">回复</a>
                               <a href="javascript:;" class="delBtn" data-id="{$v.id}" data-uid="{$v.uid}">删除</a>
                                <!-- <a href=""><i class="like-icon"></i><span class="like-num">0</span></a> -->
                            </div>
                            {if ( empty($v.son) )}
                            <div class="comt-reply">
                                <div class="comt-icon-up"></div>
                                <div class="comt-reply-box">
                                     <input class="reply" type="text">
                                    <a href="javascript:;" class="reply-btn" data-id="{$v.id}">回复</a>
                                </div>
                            </div>
                            {else /}
                            <div class="comt-reply">
                                <div class="comt-icon-up"></div>
                                <div class="comt-reply-box">
                                    {volist name="v.son" id="vo"}
                                    <div class="reply-item">
                                        <div class="comt-icon"><img src="{$vo.icon}"></div>
                                             <div class="comt-info">{$vo.name}&nbsp;&nbsp;【购买用户】
                                                <span class="stars">    
                                                        <b class="ic star-on"></b>
                                                        <b class="ic star-on"></b>
                                                        <b class="ic star-on"></b>
                                                        <b class="ic star-on"></b>
                                                        <b class="ic star-half"></b>
                                                </span>
                                         {$vo.cmt}&nbsp; {$vo.ctime} &nbsp;&nbsp;来自百度阅读</div>
                                        <div class="comt-cont">{$vo.content}</div> 
                                        <div class="comt-comt">
                                           <a href="javascript:;" class="delBtn mgr20" 
                                           data-id="{$vo.id}" data-uid="{$vo.uid}">删除</a>
                                        </div>
                                         <div class="reply-line"></div>
                                    </div>
                                    {/volist}
                                    <input class="reply" type="text">
                                    <a href="javascript:;" class="reply-btn" data-id="{$v.id}">回复</a>
                                </div>
                            </div>
                            {/if}
                        </li>
                        {/volist}
                    </ul>
                    {/if}
                </div>

            </div>

        </div>
		
        <div class="rightSide">
            <!-- 热门 -->
            <div class="hot-list">
                <div class="hot-tit"> <span class="title-icon" style="left:-15px; top: 3px;"></span>
                {$two.name}</div>
                <ul>
                    {volist name="hotdata" id="v"}
                    <li class="hot-item"><img src="{$v.face}">
                        <a href="{:url('index/Details/read',['id'=>$v.id])}" class="item-name">{$v.name}</a>
                        <a href="" class="item-author">{$v.author}</a>
                        <span class="item-p">￥{$v.price}<span class="item-read">{$v.hot}人在读</span></span>
                    </li>
                    {/volist}
                </ul>
            </div>

            <!-- 相关 -->
             <div class="hot-list">
                <div class="hot-tit"> <span class="title-icon" style="left:-15px; top: 3px;"></span>
                相关图书</div>
                <ul>
                    {volist name="likedata" id="v"}
                     <li class="hot-item"><img src="{$v.face}">
                        <a href="{:url('index/Details/read',['id'=>$v.id])}" class="item-name">{$v.name}</a>
                        <a href="" class="item-author">{$v.author}</a>
                        <span class="item-p">￥{$v.price}<span class="item-read">{$v.hot}人在读</span></span>
                    </li>
                    {/volist}
                </ul>
            </div>

            <img src="/static/index/images/ad4.jpg" class="ad">
            <img src="/static/index/images/ad3.jpg" class="ad">

            <!-- 历史 -->
            {if count($books) > 1}
             <div class="hot-list">
                <div class="hot-tit"> <span class="title-icon" style="left:-15px; top: 3px;"></span>
                浏览历史</div>
                <ul>
                    {volist name="books" id="v" offset="1" length='5'}
                     <li class="hot-item"><img src="{$v.face}">
                        <a href="{:url('index/Details/read',['id'=>$v.id])}" class="item-name">{$v.name}</a>
                        <a href="" class="item-author">{$v.author}</a>
                        <span class="item-p">￥{$v.price}<span class="item-read">{$v.hot}人在读</span></span>
                    </li>
                    {/volist}
                </ul>
            </div>
            {/if}
        </div>

        <div style="clear:both"></div>
    </div>


        <!-- Modal -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
          <div class="modal-dialog" style="margin-right:415px;">
            <div class="modal-content"style="width:800px;">
              <div class="modal-header" style="background-color:#FAFAF7;">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel" style="color:#333">购买图书</h4>
                <h5 class="modal-title" id="myModalLabel" style="float:right;color:#333;margin-top:-25px;margin-right:20px;">账号：<span style="color:#58bd5a;">{$Request.session.user.name}</span></h5>

              </div>
              <div class="modal-body">
                <div class="buyinfo">
                	<span>购买图书:</span>
                	<div class="bookdata">
                		<img src="{$data.face}">
                		<span style="margin-top:7px;display:inline-block;">{$data.name}</span>
                		<span class="howmany">共一本</span>
                	</div>
                </div>
                <div class="countnumber" s>图书总额：<span style="color:#333;">{$data.price}元</span></div>
                {if empty($vip)}
                <div class="countnumber">应付金额：<span style="font-size:20px;color:#f60;">{$data.price}</span>元</div>
                {else/}
                <div class="countnumber">应付金额：<span style="font-size:20px;color:#f60;" class="vipmoney">{$data.price*0.7}</span>元</div>
                <span style="color:red;font-size:12px;">尊敬的新芽会员，你享有7折的优惠</span>
                {/if}
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button class="btn btn-primary pay" data-id="{$data.id}">立即支付</button>
              </div>
            </div>
          </div>
        </div>
     <!-- Modal -->
   

     <div class="ft-line" style="border-bottom: 1px solid #e9eae9; margin: 40px 0 20px"></div>

	<!--footer section start-->
    <!-- <footer class="sticky-footer"> -->
    <footer style="border:0;font-size: 16px;clear:both;">
        <div class="row">
            <div class="ft-box center">
                <div class="col-md-3">
                    <div class="ft-icon ft-icon1"></div>
                    <p class="mgt10">正版电子书</p>
                </div>
                <div class="col-md-3">
                    <div class="ft-icon ft-icon2"></div>
                    <p class="mgt10">多平台畅读</p>
                </div>
                <div class="col-md-3">
                    <div class="ft-icon ft-icon3"></div>
                    <p class="mgt10">海量图书资源</p>
                </div>
                <div class="col-md-3">
                    <div class="ft-icon ft-icon4"></div>
                    <p class="mgt10">优质阅读体验</p>
                </div>
                <div style="clear:both"></div>
            </div>
                

            <div class="ft-link">
                <dl class="col-md-4">
                    <dt>帮助</dt>
                    <dd><a href="">如何购买图书</a></dd>
                    <dd><a href="">常见问题</a></dd>
                    <dd><a href="">支付方式</a></dd>
                </dl>
                 <dl class="col-md-4">
                    <dt>平台入驻</dt>
                    <dd><a href="">机构专区</a></dd>
                    <dd><a href="">个人作者专区</a></dd>
                </dl>
                 <dl class="col-md-4">
                    <dt>投诉与建议</dt>
                    <dd><a href="">问题反馈</a></dd>
                </dl>
            </div>

        </div>
    </footer>

    <!--footer section end-->



<!-- Placed js at the end of the document so the pages load faster -->
{js href="/static/layout/js/jquery-1.10.2.min.js" }
{js href="/static/layout/js/jquery-ui-1.9.2.custom.min.js" }
{js href="/static/layout/js/jquery-migrate-1.2.1.min.js" }
{js href="/static/layout/js/bootstrap.min.js" }
{js href="/static/layout/js/modernizr.min.js" }
{js href="/static/layout/js/jquery.nicescroll.js" }
{js href="/static/js/toastr.min.js"}

<!--common scripts for all pages-->
{js href="/static/layout/js/scripts.js"}
<script>
    $(function () {
        // 设置弹框参数
        toastr.options = {
            closeButton: true,// 是否显示关闭按钮
            progressBar: true,// 实现显示计时条
            timeOut: "3000",  // 自动关闭时间
            positionClass: "toast-top-right" // 提示位置
            // toast-top-full-width 顶端，宽度铺满整个屏幕
            // toast-top-right  顶端右边
        };

        // 触发添加收藏小说
        $('#collect').click(function () {
            var cid = $(this).attr('data-id');
            AddCollect(cid); // 指定添加信息操作
        });

        //触发添加购物车
        $('#buycar').click(function(){
            var bid = $(this).attr('data-id');
            AddBuyCar(bid); // 指定添加信息操作
        });

        //点击购买
        $('.pay').click(function(){
            var pid = $(this).attr('data-id');
            pay(pid);
        });

        $('.detaildesc').click(function(){
            if($(this).html() == '已购买'){
                $(this).removeAttr('data-toggle');
                toastr.error('亲~你已经购买过啦', 'FBI WARING:');
            }else{
                 var vipmoney = parseFloat($('.vipmoney').html());
                 $('.vipmoney').html(vipmoney.toFixed(2));
            }
        });

        $('.detaildesc1').click(function(){
            toastr.error('亲~请先登录~再购买哦', 'FBI WARING:');
        });

        // 发表评论
        $('.reply-btn').click(function () {
            var cid = $('#collect').attr('data-id');
            var gid = $(this).attr('data-id');
            var content = $(this).prev('.reply').val();
            var data = {'cid':cid,'gid':gid,'content':content}
            Comment(data);
        });

        // 删除评论
         $('.delBtn').click(function () {
            var id = $(this).attr('data-id');
            var uid = $(this).attr('data-uid');
            var data = {'uid':uid,'id':id}
            DelCmt(data);
        });

        // 点击展开收起
        var mark = true;
        $('.showbtn').click(function () {
            if (mark) {
                mark = !mark;
                $(this).html('查看全部');
                $(this).parent().prev().css({display:'block'});
            }else{
                mark = !mark;
                $(this).html('收起');
                $(this).parent().prev().css({display:'none'});
            }
            
        });

         // 点击展开收起
        var mark = true;
        $('.repBtn').click(function () {
            if (mark) {
                mark = !mark;
                $(this).html('收起回复');
                $(this).parent().next().css({display:'block'});
            }else{
                mark = !mark;
                $(this).html('回复');
                $(this).parent().next().css({display:'none'});
            }
            
        });
    });

    // 发表评论
    function Comment(data) {
        $.ajax({
            data:data,
            type: 'post',
            url: '/index/Comment/create.html',
            dataType:'json',
            success: function (data) {
                if (data.status) {
                    toastr.success(data.info);
                    setTimeout("window.location.reload()",1000);
                } else {
                    toastr.error(data.info, 'FBI WARING:');
                }
            },
            error: function () {
                alert('AJAX操作失败');
            }
        });
    }

    // 删除评论
    function DelCmt(data) {
        $.ajax({
            data:data,
            type: 'post',
            url: '/index/Comment/delete.html',
            dataType:'json',
            success: function (data) {
                if (data.status) {
                    toastr.success(data.info);
                    setTimeout("window.location.reload()",1000);
                } else {
                    toastr.error(data.info, 'FBI WARING:');
                }
            },
            error: function () {
                alert('AJAX操作失败');
            }
        });
    }


    function AddCollect(cid) {
        $.ajax({
            type: 'get',
            url: '/collect/'+cid,
            dataType:'json',
            success: function (data) {
                if (data.status) {
                    toastr.success(data.info);
                } else {
                    toastr.error(data.info, 'FBI WARING:');
                }
            },
            error: function () {
                toastr.error('亲~请先登录~再收藏哦', 'FBI WARING:');
            }
        });
    }


    function AddBuyCar(bid) {
        $.ajax({
            type: 'get',
            url: '/buy/'+bid,
            dataType:'json',
            success: function (data) {
                if (data.status) {
                    toastr.success(data.info);
                } else {
                    toastr.error(data.info, 'FBI WARING:');
                }
            },
            error: function () {
                toastr.error('亲~请先登录~再加入购物车哦', 'FBI WARING:');
            }
        });
    }


    function pay(pid) {
        $.ajax({
            type: 'get',
            url: '/pay/'+pid,
            dataType:'json',
            success: function (data) {
                if (data.status) {
                    toastr.success(data.info);
                    window.location.reload();
                } else {
                    toastr.error(data.info, 'FBI WARING:');
                }
            },
            error: function () {
                alert('AJAX操作失败');
            }
        });
    }




</script>
</body>
</html>